package com.sport.setting.repository;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sport.model.setting.pojos.SportEventsGrade;
import com.sport.setting.mapper.SportEventsGradeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.stream.Collectors;

@Component
@Transactional
public class SportEventsGradeRepository extends ServiceImpl<SportEventsGradeMapper, SportEventsGrade> {

    @Autowired
    SportEventsGradeMapper sportEventsGradeMapper;
    public List<String> grade(){
        return sportEventsGradeMapper.selectList(Wrappers.<SportEventsGrade>lambdaQuery()
                .select(SportEventsGrade::getSportEventsGrade))
                .stream()
                .map(SportEventsGrade::getSportEventsGrade)
                .collect(Collectors.toList());
    }
}
